package scau.redi.social_platform.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import scau.redi.social_platform.dao.SharedCommentMapper;
import scau.redi.social_platform.domain.pojo.SharedComment;
import scau.redi.social_platform.service.SharedCommentService;

import java.util.List;

/**
 * @Author: Redi
 * @Date: 2022/5/13 10:45
 * @Description:
 */
@Service
public class SharedCommentServiceImpl implements SharedCommentService {

    @Autowired
    SharedCommentMapper sharedCommentMapper;

    @Override
    public int createSharedComment(SharedComment sharedComment) {
        return sharedCommentMapper.insertSelective(sharedComment);
    }

    @Override
    public int deleteByPrimaryKeyAndUserId(int commentId, int userId) {
        return sharedCommentMapper.deleteByPrimaryKeyAndUserId(commentId, userId);
    }

    @Override
    public List<SharedComment> findFatherCommentBySharedId(int sharedId) {
        return sharedCommentMapper.selectFatherCommentBySharedId(sharedId);
    }

    @Override
    public SharedComment findById(int commentId) {
        return sharedCommentMapper.selectByPrimaryKey(commentId);
    }
}
